package com.thread.test10;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author bin
 * @date 2025 - 03 -12
 **/
public class MyRunnble implements Runnable{
    private String name;
    private double money;

    private Account account;

    public MyRunnble(String name, double money, Account account) {
        this.name = name;
        this.money = money;
        this.account = account;
    }
    private ReentrantLock reentrantLock = new ReentrantLock();
    @Override
    public void run() {
        reentrantLock.lock();
        account.withdraw(money,name);
        reentrantLock.unlock();
    }
}
